package com.jinhua.demo;

import com.jinhua.batch.ExcelBatchUtils;
import com.jinhua.batch.model.BatchProcessRequest;

import java.util.UUID;

/**
 * Copyright
 *
 * @Author WuHuang
 * @Date 2023/4/6
 */
public class test {
    public static void main(String[] args) {
        BatchProcessRequest<SpuPackageDTO> processRequest = new BatchProcessRequest<>();
        processRequest.setExcelUrl("https://stuser.blob.core.chinacloudapi.cn/dabao/RS%E5%AF%BC%E8%B4%AD%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8%E5%AF%BC%E5%87%BA-20220309121128.xlsx");                                                    // 前端上传到cos的excel文件
        processRequest.setSplitSize(10);                                                        // 分批处理的大小
        processRequest.setLineClass(SpuPackageDTO.class);                                       // excel每行数据的model
        processRequest.setTaskId(UUID.randomUUID().toString());                                 // 任务id，后面查询进度时会用到
        processRequest.setBatchCallbackHandler(new BatchActivitySpuCallbackHandler());          // 业务处理的回调函数
        ExcelBatchUtils.batchProcessExcel(processRequest);                                      // 提交处理任务

    }
}
